if exist dest rd/s/q dest

if exist autoTestServer.jar del autoTestServer.jar

mkdir "dest/libs"
mkdir "dest/bin"

copy libs\*.jar dest\libs\

::SET JAR_SRC=libs\commons-beanutils-1.7.0.jar;libs\commons-collections-3.2.1.jar;libs\commons-httpclient-3.1.jar;libs\commons-lang-2.3.jar;libs\commons-logging-1.1.1.jar;libs\ezmorph-1.0.3.jar;libs\json-lib-2.2.3-jdk15.jar;libs\mysql-connector-java-3.1.11-bin.jar;libs\servlet-api-3.1.jar;libs\start.jar
::SET JETTY_JAR_SRC=libs\jetty-continuation-9.2.21.v20170120.jar;libs\jetty-http-9.2.21.v20170120.jar;libs\jetty-io-9.2.21.v20170120.jar;libs\jetty-quickstart-9.2.21.v20170120.jar;libs\jetty-security-9.2.21.v20170120.jar;libs\jetty-server-9.2.21.v20170120.jar;libs\jetty-servlet-9.2.21.v20170120.jar;libs\jetty-util-9.2.21.v20170120.jar

setlocal enabledelayedexpansion
FOR %%i IN ("libs\*.jar") DO SET CP=%%i;!CP!
echo %CP%
javac -d dest\bin -cp %CP% -encoding utf-8 src/autoTest/*.java src/autoTest/command/*.java src/autoTest/database/*.java src/autoTest/device/*.java src/autoTest/parser/*.java src/autoTest/request/*.java src/autoTest/utils/*.java src/main/*.java
::javac -d dest\bin -cp %JAR_SRC%;%JETTY_JAR_SRC% -encoding utf-8 src/autoTest/*.java
::javac -d dest\bin -cp %JAR_SRC%;%JETTY_JAR_SRC% -encoding utf-8 src/autoTest/database/*.java
::javac -d dest\bin -cp %JAR_SRC%;%JETTY_JAR_SRC% -encoding utf-8 src/autoTest/device/*.java
::javac -d dest\bin -cp %JAR_SRC%;%JETTY_JAR_SRC% -encoding utf-8 src/autoTest/parser/*.java
::javac -d dest\bin -cp %JAR_SRC%;%JETTY_JAR_SRC% -encoding utf-8 src/autoTest/request/*.java
::javac -d dest\bin -cp %JAR_SRC%;%JETTY_JAR_SRC% -encoding utf-8 src/autoTest/utils/*.java
::javac -d dest\bin -cp %JAR_SRC%;%JETTY_JAR_SRC% -encoding utf-8 src/main/*.java

endlocal

cd dest/bin

jar -cvf ../../autoTestServer.jar *

cd ..


::FOR %%i IN ("libs\*.jar") DO SET CP=%%i;!CP!
::SET OPT=-d %OUTPUT_PATH%\bin -cp %CP% -encoding utf-8


cd ..

::java -jar autoTestServer.jar
setlocal enabledelayedexpansion
FOR %%i IN ("libs\*.jar") DO SET JARS=%%i;!JARS!
echo %JARS%
java -cp %JARS%;autoTestServer.jar main.ServerMain
endlocal
